﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using XStudio.XCRF.Data.Entities;
using System.Linq.Expressions;

namespace XStudio.XCRF.Data.Business
{
    public static class PatientBusiness
    {
        /// <summary>
        /// 寻找患者
        /// </summary>
        /// <param name="idCard">患者身份证号</param>
        /// <returns></returns>
        public static Patient Find(this IQueryable<Patient> Patients, string idCard)
        {
            return Patients.Find(p => p.IDCard == idCard).First();
        }
        /// <summary>
        /// 判断病人是否存在
        /// </summary>
        /// <param name="idCard">病人身份证号</param>
        /// <returns></returns>
        public static bool Exist(this IQueryable<Patient> Patients, string idCard)
        {
            return Patients.Exist(p => p.IDCard == idCard);
        }
    }
}
